package com.cv.platform.api.message;

import com.cv.framework.common.utils.object.BeanUtils;
import com.cv.platform.api.message.dto.CvMessageDTO;
import com.cv.platform.controller.platform.message.vo.record.CvMessageSaveReqVO;
import com.cv.platform.service.message.CvMessageService;
import org.apache.dubbo.config.annotation.DubboService;

import javax.annotation.Resource;

/**
 * 视频平台 - 私信 API 接口实现类
 *
 * @author Charles_XDXD
 */
@DubboService
public class CvMessageApiImpl implements CvMessageApi {

    @Resource
    private CvMessageService cvMessageService;

    @Override
    public void saveMessage(CvMessageDTO cvMessageDTO) {
        CvMessageSaveReqVO reqVO = BeanUtils.toBean(cvMessageDTO, CvMessageSaveReqVO.class);
        cvMessageService.saveMessage(reqVO);
    }

    @Override
    public void setRead(Long conversationId) {
        cvMessageService.setRead(conversationId);
    }

    @Override
    public void deleteAllMessage(Long userId) {
        cvMessageService.deleteAllMessage(userId);
    }

}
